import request from '@/router/axios';


//查询文件夹 - 所有
export const queryFolder = () => {
  return request({
    url: '/api/blade-email/tEmailArchive',
    method: 'get'
  })
}
//查询子文件夹
export const querySonFolder = (id) => {
  return request({
    url: `/api/blade-public/dictEmailArchiveDir/${id}/children`,
    method: 'get'
  })
}
//添加文件夹
export const addFolder = (row) => {
  return request({
    url: '/api/blade-email/tEmailArchive/save',
    method: 'post',
    headers: {
      "Content-Type": "application/json"
    },
    data: JSON.stringify(row)
  })
}

//添加子文件夹
export const addFolderSon = (row) => {
  return request({
    url: `/api/blade-public/dictEmailArchiveDir/${row.id}/child`,
    method: 'post',
    headers: {
      "Content-Type": "application/json"
    },
    data: JSON.stringify(row)
  })
}
//修改文件夹
export const updateFolder = (row) => {
  return request({
    url: `/api/blade-email/tEmailArchive/update`,
    method: 'post',
    headers: {
      "Content-Type": "application/json"
    },
    data: JSON.stringify(row)
  })
}

//删除文件夹
export const delFolder = (id) => {
  return request.delete(`/api/blade-email/tEmailArchive/${id}`, {params: {id: id}})
}
//查询规则
export const queryRule = () => {
  return request({
    url: '/api/blade-email/rule',
    method: 'get'
  })
}
//添加规则
export const addRules = (row) => {
  return request({
    url: '/api/blade-email/rule',
    method: 'post',
    headers: {
      "Content-Type": "application/json"
    },
    data: JSON.stringify(row)
  })
}
//修改规则
export const updateRules = (row) => {
  return request.put(`/api/blade-public/rule/${row.id}`, row)
}
